#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>

using namespace std;
#include"vector.h"
void test()
{
	string a = "hello world";

	string b = a;

	if (a.c_str() == b.c_str())

	{

		cout << "true" << endl;

	}

	else cout << "false" << endl;

	string c = b;

	c = "";

	if (a.c_str() == b.c_str())

	{

		cout << "true" << endl;

	}

	else cout << "false" << endl;

	a = "";

	if (a.c_str() == b.c_str())

	{

		cout << "true" << endl;

	}

	else cout << "false" << endl;
}
void test1()
{
	string strText = "How are you?";

	string strSeparator = " ";

	string strResult;

	int size_pos = 0;

	int size_prev_pos = 0;

	while ((size_pos = strText.find_first_of(strSeparator, size_pos)) != string::npos)

	{

		strResult = strText.substr(size_prev_pos, size_pos - size_prev_pos);

		cout << strResult << " ";

		size_prev_pos = ++size_pos;

	}

	if (size_prev_pos != strText.size())

	{

		strResult = strText.substr(size_prev_pos, size_pos - size_prev_pos);

		cout << strResult << " ";

	}

	cout << endl;
}

	string addStrings(string num1, string num2) {
		int flag = 0;
		char ret1 = '\0';
		char ret2 = '\0';
		string num3 = "";
		while (!num1.empty() || !num2.empty())
		{
			if (num1.empty())
			{
				ret1 = '0';
			}
			else
			{
				ret1 = num1.back();
				num1.pop_back();
			}
			if (num2.empty())
			{
				ret2 = '0';
			}
			else
			{
				ret2 = num2.back();
				num2.pop_back();
			}
			char ch='\0';
			int add = ret1 - '0' + ret2 - '0' + flag;
			if (add >= 10)
			{
				flag = 1;
				ch = add % 10 + 48;
			}
			else
			{
				ch = add % 10 + 48;
				flag = 0;
			}
			num3.push_back(ch);

		}
		reverse(num3.begin(),num3.end());
		return num3;
	}
	class Solution {
	public:
		bool isPalindrome(string s) {
			for (char& e : s)
			{
				if (e <= 'Z' && e >= 'A')
				{
					e += 32;
				}
				if ((e > '9' || e < '0') && (e < 'a' || e>'z'))
				{
					e = '\0';
				}
			}
			string s1 = "";
			for (char e : s)
			{
				if (e != '\0')
				{
					s1.push_back(e);
				}
			}
			string s2 = s1;
			reverse(s2.begin(), s2.end());
			if (strcmp(s2.c_str(),s1.c_str())==0)
			{
				cout << true;
			}
			else
			{
				cout << false;
			}
		}
	};
	string reverseWords(string s) {
		size_t pos = 0;
		size_t prev_pos = 0;
		while ((pos = s.find_first_of(' ', pos)) != string::npos)
		{
			reverse(s.begin() + prev_pos, s.begin() + pos);
			prev_pos = ++pos;
		}
		reverse(s.begin()+ prev_pos, s.end());
		return s;
	}
int main()
{
	string s1 = reverseWords("df fhe   ufgvgr");
	cout << s1;
	return 0;
}
